﻿<fluent:RibbonTabItem x:Class="XSemmel.Xslt.Ribbon.XsltTab"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
            xmlns:Commands="clr-namespace:XSemmel.Xslt.Commands" 
            xmlns:commands="clr-namespace:XSemmel.Commands"
            xmlns:fluent="clr-namespace:Fluent;assembly=Fluent"
            mc:Ignorable="d" 
            Header="Xslt">
    <fluent:RibbonTabItem.Resources>
        <Commands:XsltNewXSemmelCommand x:Key="XsltNewXSemmelCommand" />
        <Commands:XsltNewFileCommand x:Key="XsltNewFileCommand" />
        <commands:NewWindowCommand x:Key="NewWindowCommand"/>
    </fluent:RibbonTabItem.Resources>

    <fluent:RibbonGroupBox Header="Transformation" Icon="/Images/112_Tick_Green_32x32_72.png" >

        <StackPanel Orientation="Vertical" >
            <fluent:ToggleButton
                            x:Name="_chkXsltInEditor" x:FieldModifier="private" 
                            SizeDefinition="Middle, Small"
                            Header="Use document in editor to transform following xml file:"
                            IsChecked="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data.XsltData.XsltInEditor}"/>
            <fluent:ToggleButton
                            x:Name="_chkXmlInEditor" x:FieldModifier="private" 
                            SizeDefinition="Middle, Small"
                            Header="Transform document in editor with following xslt stylesheet:"
                            IsChecked="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data.XsltData.XmlInEditor}"/>

            <Border CornerRadius="2"
                    BorderBrush="LightGray"
                    BorderThickness="1"
                    Padding="1">
                <StackPanel Orientation="Horizontal">
                    <Label Padding="3 0 3 0" VerticalAlignment="Center">File:</Label>
                    <TextBox x:Name="_edtFile" x:FieldModifier="private" Width="267"
                             Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data.XsltData.File, UpdateSourceTrigger=PropertyChanged}"
                             >
                        <TextBox.ContextMenu>
                            <ContextMenu>
                                <MenuItem Command="Cut">
                                    <MenuItem.Icon>
                                        <Image Source="/Images/cut.png" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Command="Copy">
                                    <MenuItem.Icon>
                                        <Image Source="/Images/copy.png" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Command="Paste">
                                    <MenuItem.Icon>
                                        <Image Source="/Images/Paste_16x16.png" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <Separator/>
                                <MenuItem Header="Edit Xslt File" Click="mnuEditXslt_Click" />
                                <MenuItem Header="Copy file path to clipboard" Click="mnuCopyXsdPath_Click" />
                            </ContextMenu>
                        </TextBox.ContextMenu>
                    </TextBox>
                    <fluent:Button Margin="0" Header="..." Click="mnuSelectXsltFile_Click" SizeDefinition="Middle, Small" Height="18"/>
                </StackPanel>
            </Border>
        </StackPanel>

        <fluent:Button
            Header="Transform into new window"
            LargeIcon="/Images/XSLT_32x32.png"
            Command="{StaticResource XsltNewXSemmelCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"                        
        />
        <fluent:Button
            Header="Transform into new file"
            LargeIcon="/Images/XSLT_32x32.png"
            Command="{StaticResource XsltNewFileCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />
    </fluent:RibbonGroupBox>

    <fluent:RibbonGroupBox Header="Extras" Icon="/Images/Document_blank_16x16.png" >
        <fluent:Button
            Header="New Xsemmel window"
            Icon="/Images/Document_blank_16x16.png"
            LargeIcon="/Images/Document_blank_32x32.png"
            Command="{StaticResource NewWindowCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />
    </fluent:RibbonGroupBox>


</fluent:RibbonTabItem>
